package com.zjh.springcloud.feign;

import com.zjh.common.R;
import com.zjh.entity.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * ClassName: OrderFeign
 * Description:
 * @Author zjh
 * @Create 2023/10/30 13:37
 */
@FeignClient("order")
public interface OrderFeign {
	@GetMapping("/order/findAllByState/{state}/{begin}/{len}")
	public R<List<Order>> findByState(@PathVariable Integer state,
	                                  @PathVariable Integer begin,
	                                  @PathVariable Integer len);
	
	@DeleteMapping("order/deleteByCondition/{uid}/{mid}/{aid}")
	void deleteByCondition(@PathVariable(required = false) Integer uid,
	                       @PathVariable(required = false)Integer mid,
	                       @PathVariable(required = false)Integer aid);
	
	@PostMapping("order/save")
	void save(Order order);
	
	@GetMapping("order/findAllByUid/{uid}/{begin}/{len}")
	public R<List<Order>> findByUid(@PathVariable Integer uid,
	                         @PathVariable Integer begin,
	                         @PathVariable Integer len);
	
	@GetMapping("order/updateState/{id}/{aid}/{state}")
	public void updateState(@PathVariable Integer id,
	                        @PathVariable Integer aid,
	                        @PathVariable Integer state);
}
